<!-- 蓝色简洁登录页面 -->
<template>
 <view class="container">
	 <view style="margin-bottom: 30rpx;"><wd-text
  text="您好，欢迎登录" color="#BA573C" size="40rpx"  bold
></wd-text>
</view>
 
 	 <button   class="send-veiw"  open-type="getPhoneNumber" @getphonenumber="onGetPhoneNumber" >
<!-- 			<view class="t-g" @tap="wxLogin()"><image class="tg" src="@/static/wx.png"></image></view> -->
 	 	  <view>手机号一键登录</view>
	 	<wd-toast />
	 	
	 	</button>
		<button  @click="wx()">wx</button>
 </view>
</template>
<script setup>
	import {
		request
	} from "../../js/request";
function	onGetPhoneNumber(e){
		console.log(e);
		let code=e.detail.code;
		let res = request({
		
			url: '/app/user/registerAndLogin?code='+code
		
		});
		res.then(success => {
		 console.log(success);
		 	uni.showToast({ title: '登录成功！', icon: 'none' });
			getApp().globalData.token=success;
		 uni.setStorageSync('user-token', success);
		  uni.redirectTo({
		 	url: '/pages/chat/chat'
		  });
		}).catch(error => {
			console.log("catch" + error.code)
		});
 
	}
	
	function wx(){
		uni.login({
		  provider: 'weixin', //使用微信登录
		  success: function (loginRes) {
		    console.log(loginRes.code);
		  }
		});
	}
 </script>
 <style>
	 .container{
		   display: flex;
		   justify-content: center; /* 水平居中 */
		   align-items: center; /* 垂直居中 */
		   width: 100%; /* 宽度100% */
		   height: 100vh; /* 高度视窗的100% */
		background-size: cover;
		background-position: center;
		flex-flow: column;
		background-image: url('https://g6666.online/files/fo3.jpg');
	 }
 .send-veiw{
	 background-color: #03BC03; border-radius: 15px;
 	 width: 80%;
	 display: flex;
		color: #fff;
	  justify-content: center; /* 水平居中 */
	   align-items: center; /* 垂直居中 */
	 font-size: 40rpx;
	 opacity: 0.9;
   }
 
  .tg{
	  padding-top: 40rpx;
	  padding-right: 20rpx;
	  width: 60rpx;
	  height: 60rpx;
	  
  }
 </style>
 